const Koa = require('koa')
const Router = require('koa-router')
const static = require('koa-static')
const bodyParser = require('koa-bodyparser')
const app = new Koa()

const conf = require('./conf')
app.use(bodyParser)
const router = new Router()

app.use(static(__dirname + '/'))

const wechat = require('co-wechat')
// 同时发两个请求
router.all('/wechat', wechat(conf).middleware(
  async message => {
    console.log('wechat:', message)
    return 'hello world' + message.Content
  }
))

app.use(router.routes())
app.use(router.allowedMethods())
app.listen(3000)


